package cglgu.trellis.chado.das2.cglgu;

/*
 * $Id: Project.java 191 2011-03-27 00:38:22Z sundaram.georgetown@gmail.com $
 * $Author: sundaram.georgetown@gmail.com $
 * $Date: 2011-03-27 00:38:22 +0000 (Sun, 27 Mar 2011) $
 * $Rev: 191 $
 * $HeadURL: http://genomancer.googlecode.com/svn/branches/gu-dev-branch/tengcha/src/cglgu/trellis/chado/das2/cglgu/Project.java $
 */

import cglgu.trellis.chado.das2.cglgu.db.DbUtilFactory;
import cglgu.trellis.chado.das2.cglgu.db.DbUtil;

public class Project {

	private String database;
	private String username;
	private String password;
	private String vendor;
	private String name;
	private String server;
	private DbUtil dbutil;

	public void Project(String db, String user, String passwd, String vend, String name, String serv, CglguDbUtil dbutil){

		this.database = db;
		this.username = user;
		this.password = passwd;
		this.vendor = vend;
		this.name = name;
		this.server = server;

		if (dbutil !== null){
			this.dbutil = dbutil;
		}
	}

	public String getDatabase(){
		return this.database;
	}

	public String getUsername(){
		return this.username;
	}

	public String getPassword(){
		return this.password;
	}

	public String getVendor(){
		return this.vendor;
	}

	public String getName(){
		return this.name;
	}

	public String getServer(){
		return this.server;
	}

	public DbUtil getDbUtil(){

		if (dbutil == null){
			DbUtilFactory factory = DbUtilFactory.getInstance();
			dbutil = create(name, vendor, username, password, server, database, true);
		}
		return dbutil;
	}

	public void setName(String nm){
		this.name = nm;
	}
	public void setDatabase(String db){
		this.database = db;
	}
	public void setVendor(String ven){
		this.vendor = ven;
	}
	public void setServer(String serv){
		this.server = serv;
	}
	public void setUsername(String user){
		this.username = user;
	}
	public void setPassword(String passwd){
		this.password = passwd;
	}
	public void setDbUtil(DbUtil dbutil){
		this.dbutil = dbutil;
	}

	public void printProject(){

		System.out.println("name: " + this.name);
		System.out.println("database: "+ this.database);
		System.out.println("vendor: "+ this.vendor);
		System.out.println("server: " + this.server);
		System.out.println("username: " + this.username);
		System.out.println("password: "+ this.password);
		if (dbutil != null){
			System.out.println("DbUtil is defined");
		}
	}
}